<%@page import="java.util.Map"%>
<%@page import="java.util.ArrayList"%>
<%@page import="goomi.picture.pictureService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
pictureService pic = new pictureService();
ArrayList picList = pic.getPicture("user");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<title>Insert title here</title>
<script type="text/javascript">
function uploadPic(){
	$('#UploadForm').each(function(){
        this.reset();
	});
	$('#uploadDiv').show();
}

function afterUpload(){
	$('#d6').load("jsp/GoomiFamily/goomiFamily2.jsp");
}

$(document).ready(function() {
	$('#uploadDiv').hide();
	$('#upload').hide();
	$('#uploadBut').button().click(function(){
		uploadPic();
	});
});
</script>
</head>
<body>
<%if(session.getAttribute("id") != null){ %>
<button id='uploadBut'>上傳圖片</button>
<% } %>
<div id=uploadDiv>
  <form id="UploadForm" name="UploadForm"  target="upload"
enctype="multipart/form-data" method="post" action="jsp/system/upload.jsp">
 選擇檔案<input type="file" name="File1" size="50" maxlength="200" />
<br>
<input type="hidden" id="item_id" name="item_id" size="50" value="<%=session.getAttribute("id") %>"/>
<input type="hidden" id="item_type" name="item_type" size="50" value="user"/>
<br>  
  <input type="submit" value="上傳">
  </form>
 <iframe id="upload" frameborder="0"></iframe>
</div>
<table>
<%
for(int i = 0 ; i < picList.size() ; i++){
	Map item = (Map)picList.get(i);
%>
<tr>
<td><img src="/Goomi/Download.template?type=img&path=<%=item.get("path") %>" /></td>
<td valign="top">upload by <%=item.get("name") %> at <%=item.get("create_date") %></td>
</tr>
<%
}
%>
</table>
</body>
</html>